<template>
  <div class="root">
    <!-- <h1>我是分类侧边列表组件</h1> -->
    <ul>
      <li
        @click="tzfl(v.cateid, i)"
        :id="i"
        v-for="(v, i) in glList"
        :key="v.cateid"
        :class="{ lvl: i == defi }"
      >
        {{ v.name }}
      </li>
    </ul>
    <div class="rmpa">
      <zlandrm :ingg="zlrm"></zlandrm>
    </div>
  </div>
</template>

<script>
import zlandrm from "./zlandrm.vue";
export default {
  name: "Sidebar",
  data() {
    return {
      glList: null,
      zlrm: 5,
      defi: 0,
    };
  },
  components: {
    zlandrm,
  },
  async created() {
    let glList = await this.axios({
      url: "https://mallcdn.api.epet.com/v3/goods/category/main.html?pet_type=dog&version=358&system=wap&isWeb=1&distinct_id=17c2b39bc8d274-022dcac363853b8-17466957-230400-17c2b39bc8e91c&_=1633089395114",
    });
    // console.log(glList.data.categorys);
    this.glList = glList.data.categorys;
  },
  methods: {
    tzfl(id, i) {
      this.zlrm = id;
      this.defi = i;
    },
  },
};
</script>

<style lang="less" scoped>
.root {
  display: flex;
  width: 100%;
  //   box-sizing: border-box;

  border: 0 !important;
  > ul {
    position: fixed;
    top: 0.8rem;
    left: 0;
    > li {
      width: 1.4rem;
      height: 0.38rem;
      line-height: 0.38rem;
      text-align: center;
      padding: 0.3rem 0;
      border-bottom: 1px solid rgb(219, 219, 219);
    }
  }
  .rmpa {
    width: 6rem;
    margin-left: 1.4rem;
    border-top: 0.08rem solid rgb(226, 226, 226);
  }
}
.lvl {
  color: rgb(10, 185, 40);
  background-color: rgb(243, 244, 245);
}
</style>